const express = require('express');
const fs = require('fs');

const app = express(); // 创建一个express对象  
const port = 3000;

const requestTime = function (req, res, next) {
  req.requestTime = Date.now()
  next()
}
app.use(requestTime)
// 响应
app.get('/', (req, res) => {
  res.send('hello world'+ req.requestTime)
});

//开启服务器监听
app.listen(port, () => {
  console.log(`server is running on port ${port}`);
})